package com.heima.wemedia;

import com.heima.common.aliyun.GreenImageScan;
import com.heima.common.aliyun.GreenTextScan;
import com.heima.file.service.FileStorageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author xiaoxiaode
 * @date 2021/9/28 18:58
 **/

@RunWith(SpringRunner.class)
@SpringBootTest(classes = WemediaApplication.class)
public class test {


    @Autowired
    private GreenTextScan greenTextScan;

    @Autowired
    private GreenImageScan greenImageScan;

    @Autowired
    private FileStorageService fileStorageService;


    @Test
    public  void testText() throws Exception {
        Map map = greenTextScan.greeTextScan("卧室嫩叠 毒冰好吃");
        System.out.println(map);
    }

    @Test
    public  void testImage() throws Exception{
        byte[] bytes = fileStorageService.downLoadFile("http://192.168.200.130:9000/leadnews/2021/09/27/cf134035c2da4145850e656e10c4668a.jpg");

        List<byte []> list=new ArrayList<>();

        list.add(bytes);

        Map map = greenImageScan.imageScan(list);
        System.out.println(map);
    }
}
